<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var day = 1;
        switch (day) {
            case 1:
                alert('Day is Monday');
                break;
            case 2:
                alert('Day is Tuesday');
                break;
            case 3:
                alert('Day is Wednesday');
                break;
            case 4:
                alert('Day is Thursday');
                break;
            case 5:
                alert('Day is Friday');
                break;
            case 6:
                alert('Day is Saturday');
                break;
            case 7:
                alert('Day is Sunday');
                break;
            default:
                alert('Not a valid number:' + day);
                break;
        }
        // 测试时，可以去掉其中一个break，查看效果。
    </script>
</body>

</html>

<!-- switch语句 -->
<!-- https://developer.mozilla.org/zh-CN/docs/Learn/JavaScript/Building_blocks/conditionals#switch%E8%AF%AD%E5%8F%A5 -->

<!-- switch -->
<!-- https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/switch -->